package com.future.mayi.activity;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;

import com.future.baselib.entity.DefaultResponse;
import com.future.baselib.utils.ApiCst;
import com.future.baselib.utils.HttpRequest;
import com.future.baselib.view.NoScrollViewPager;
import com.future.mayi.R;
import com.future.mayi.app.App;
import com.future.mayi.fragment.ChangePhoneFragment1;
import com.future.mayi.fragment.ChangePhoneFragment2;
import com.future.mayi.fragment.SettingPayPasswordFragment;
import com.future.mayi.model.interfaces.SettingPayPasswordListener;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class ChangePhoneActivity extends BaseTitleActivity {

    @BindView(R.id.view_pager)
    NoScrollViewPager viewPager;


    @Override
    protected void initTopBar() {
        initBack();
        getTitleText().setText("修改手机号");
    }

    @Override
    protected void initLayout() {
        setContentView(R.layout.activity_setting_pay_password);
    }

    private List<Fragment> fragmentList;

    @Override
    protected void initView() {
        fragmentList = new ArrayList<>(2);
        ChangePhoneFragment1 changePhoneFragment1 = new ChangePhoneFragment1();
        fragmentList.add(changePhoneFragment1);
        ChangePhoneFragment2 changePhoneFragment2 = new ChangePhoneFragment2();
        fragmentList.add(changePhoneFragment2);
        viewPager.setNoScroll(true);
        viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
            @Override
            public Fragment getItem(int position) {
                return fragmentList.get(position);
            }

            @Override
            public int getCount() {
                return fragmentList.size();
            }
        });

    }

    @Override
    protected void initDates() {

    }

    @Override
    protected void initListener() {

    }

    public void setNext() {
        viewPager.setCurrentItem(1);
    }


    @Override
    public void onBackPressed() {
        if (viewPager.getCurrentItem() > 0) {
            viewPager.setCurrentItem(0);
            return;
        }
        super.onBackPressed();
    }
}
